(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;class TimeQuote{constructor(e){this.blockItem=e.blockItem,this.blockAuthor=e.blockAuthor,this.blockSource=e.blockSource}getQuote(){const e=new Date,t=e.getHours(),o=e.getMinutes();fetch(`/api?time=${t}${o<10?`0${o}`:o}`).then((e=>e.json())).then((e=>{e.status?(this.blockItem.innerHTML=e.data.quote,this.blockAuthor.innerHTML=e.data.author,this.blockSource.innerHTML=e.data.source):(this.blockItem.innerHTML=this.setWordTime(t,o),this.blockAuthor.innerHTML="",this.blockSource.innerHTML="")})).catch((e=>{console.error("data request fails: ",e)}))}setWordTime(e,t){const o=["ночи","утра","дня","вечера"],s=["час","часа","часов"],r=["минута","минуты","минут"],i=["двадцать","тридцать","сорок","пятьдесят"],c=["одна","две","три","четыре","пять","шесть","семь","восемь","девять","десять","одиннадцать","двенадцать","тринадцать","четырнадцать","пятнадцать","шестнадцать","семнадцать","восемнадцать","девятнадцать"];let a=e>12?e-12:e,l=t;switch(a){case 0:a="Двенадцать";break;case 1:a=s[0].replace(s[0][0],s[0][0].toUpperCase());break;case 2:a="Два";break;default:a=c[a-1].replace(c[a-1][0],c[a-1][0].toUpperCase())}if(l<20)l=` и ${c[l-1]}`,l+=1==l?` ${r[0]}`:l>1&&l<5?` ${r[1]}`:` ${r[2]}`;else if(l>19&&l%10==0)l/=10,l=` и ${i[l-2]} ${r[2]}`;else{let e;l=String(l).split(""),e=1==l[1]?` ${r[0]}`:l[1]>1&&l[1]<5?` ${r[1]}`:` ${r[2]}`,l=`и ${i[l[0]-2]} ${c[l[1]-1]} ${e}`}let u=e;return u<6?(u>1&&u<5&&(a+=` ${s[1]}`),0===u&&(a+=` ${s[2]}`),a+=` ${o[0]}`):u>5&&u<13?a+=` ${s[2]} ${o[1]}`:13===u?a+=` ${o[2]}`:u>13&&u<17?a+=` ${s[1]} ${o[2]}`:u>16&&(a+=` ${s[2]} ${o[3]}`),`${a} ${l}`}getTimer(){this.getQuote(),setInterval((()=>{setTimeout(this.getQuote())}),1e4)}}exports.default=TimeQuote;

},{}],2:[function(require,module,exports){
"use strict";var _toggleTheme=require("./toggle-theme.js"),_getQuote=_interopRequireDefault(require("./getQuote.js"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const timeChecker=new _getQuote.default({blockItem:document.querySelector(".quote-block--item"),blockAuthor:document.querySelector(".quote-block--author"),blockSource:document.querySelector(".quote-block--source")}),main=document.querySelector("main"),toggleButton=document.querySelector(".toggle-theme");(0,_toggleTheme.themeToggler)(main,toggleButton),timeChecker.getTimer();

},{"./getQuote.js":1,"./toggle-theme.js":3}],3:[function(require,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.themeToggler=void 0;const themeToggler=(e,t)=>{t.addEventListener("click",(()=>{e.classList.toggle("dark")}))};exports.themeToggler=themeToggler;

},{}]},{},[2])

//# sourceMappingURL=script.js.map
